const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV)
// const fs = require('fs')

module.exports = {
  publicPath: '/',
  outputDir: 'dist',

  lintOnSave: false,
  parallel: true,
  // css: {
  //   loaderOptions: {
  //     sass: {
  //       data: fs.readFileSync('src/variables.scss', 'utf-8')
  //     }
  //   }
  // },
  devServer: {
    open: IS_PROD,
    host: 'localhost', //真机测试0.0.0.0
    port: 8181,
    https: false,
    hotOnly: false,
    proxy: {
      '/apij': {
        target: process.env.VUE_APP_BASE_API || 'http://127.0.0.1:8080',
        changeOrigin: true,
        pathRewrite: {
          '^/apij': '' // rewrite path
        }
      },
      "/foo": {
        target: "https://myweb-921214.firebaseio.com",
        ws: true,
        changeOrigin: true,
        pathRewrite: {
          '^/foo': ''
        }
      }
    }
  }
}